/**
 * 报表设计公司(2011)
 */
package com.reportgear.report.view.grid.support;

import net.abbp.report.model.ReportModel;

import com.reportgear.report.model.auxiliary.RowType;

/**
 * 默认行头渲染器
 * 
 * @version 1.0 2011-3-14
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 * 
 */
public class DefaultGridRowCRRenderer implements GridCRRenderer {
	private ReportModel reportModel;

	/**
	 * 构造器
	 * 
	 * @param reportModel
	 *            对应的报表模型
	 */
	public DefaultGridRowCRRenderer(ReportModel reportModel) {
		this.reportModel = reportModel;
	}

	@Override
	public Object getDisplayInfo(int index) {
		RowType type = this.reportModel.getRowType(index);

		switch (type) {
		case NORMAL:
			return index + 1;
		case HEADER:
			return "" + (index + 1) + "(H)";
		case FOOTER:
			return "" + (index + 1) + "(F)";
		}

		return "";
	}

}
